package com.working.wanandroid.main

import android.content.res.ColorStateList
import android.graphics.Color
import androidx.lifecycle.ViewModel
import androidx.navigation.NavController
import com.alibaba.android.arouter.launcher.ARouter
import com.google.android.material.bottomnavigation.BottomNavigationView
import com.working.libbase.initializer.ApplicationProvider
import com.working.libbase.storage.Storage

class MainViewModel : ViewModel() {

      val mBackUpList = Storage.backUpList

    private val mainProvider: ApplicationProvider by lazy {
        ARouter.getInstance().navigation(ApplicationProvider::class.java)
    }

    fun buildGraph(navController: NavController) {
        mainProvider.build(navController)
    }

    fun buildNav(bottomNav: BottomNavigationView) {
        bottomNav.itemTextColor = ColorStateList(
            arrayOf(intArrayOf(android.R.attr.state_checked), intArrayOf()),
            intArrayOf(Color.RED, Color.BLACK)
        )
        mainProvider.build(bottomNav.menu)
    }

}
